<template>
	<view class="box">
		<u-navbar :fixed="true" :placeholder="true" title="演练记录" @leftClick="leftClick" bgColor="#0F53AC"
			leftIconColor="#fff">
		</u-navbar>
		<view class="top">
			<view class="title-top">{{dataForm.name}}</view>
			<view class="top-tags">
				<view class="tag-info">{{dataForm.itemCategory}}</view>
			</view>
		</view>
		<view class="line8"></view>
		<view class="kiss-upDown-list">
			<view class="bx-list-title">
				<view class="left">
					<view style="color: red;">*</view>
					演练过程、人员培训情况描述
				</view>
			</view>
			<view class="input-textrea">
				<u--textarea class="textrea" count v-model="drillRecord.content" cursorSpacing="60"
					placeholder="请对演练过程、人员培训情况进行描述" maxlength="500">
				</u--textarea>
			</view>
		</view>
		<view class="kiss-list" @click="showAdequacy=true">
			<view class="kiss-list-title">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					预案适宜性评审
				</view>
				<view class="right1" style="width: 58vw;" v-if="isInspec == 0">
					<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
						:class="[drillRecord.adequacyName != '' ? 'select-bg' : 'sel']">
						{{ drillRecord.adequacyName != '' ? drillRecord.adequacyName : '请选择' }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
				<view class="right1" style="width: 58vw;" v-else>
					<view :class="[drillRecord.adequacyName != '' ? 'select-bg' : '']">
						{{ drillRecord.adequacyName != '' ? drillRecord.adequacyName : '无' }}
					</view>
				</view>
			</view>
		</view>
		<view class="kiss-list" @click="showSufficiency=true">
			<view class="kiss-list-title">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					预案充分性评审
				</view>
				<view class="right1" style="width: 58vw;" v-if="isInspec == 0">
					<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
						:class="[drillRecord.sufficiencyName != '' ? 'select-bg' : 'sel']">
						{{ drillRecord.sufficiencyName != '' ? drillRecord.sufficiencyName : '请选择' }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
				<view class="right1" style="width: 58vw;" v-else>
					<view :class="[drillRecord.sufficiencyName != '' ? 'select-bg' : '']">
						{{ drillRecord.sufficiencyName != '' ? drillRecord.sufficiencyName : '无' }}
					</view>
				</view>
			</view>
		</view>
		<!-- 人员到位情况 -->
		<view class="kiss-list" @click="handleShowAdvent">
			<view class="kiss-list-title">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					人员到位情况
				</view>
				<view class="right1" style="width: 58vw;" v-if="isInspec == 0">
					<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
						:class="[drillRecord.adventName != '' ? 'select-bg' : 'sel']">
						{{ drillRecord.adventName != '' ? drillRecord.adventName : '请选择' }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
				<view class="right1" style="width: 58vw;" v-else>
					<view :class="[drillRecord.adventName != '' ? 'select-bg' : '']">
						{{ drillRecord.adventName != '' ? drillRecord.adventName : '无' }}
					</view>
				</view>
			</view>
		</view>
		<view class="kiss-list" @click="showMaterials=true">
			<view class="kiss-list-title">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					现场物资
				</view>
				<view class="right1" v-if="isInspec == 0">
					<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
						:class="[drillRecord.materialsName != '' ? 'select-bg' : 'sel']">
						{{ drillRecord.materialsName != '' ? drillRecord.materialsName : '请选择' }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
				<view class="right1" v-else>
					<view :class="[drillRecord.materialsName != '' ? 'select-bg' : '']">
						{{ drillRecord.materialsName != '' ? drillRecord.materialsName : '无' }}
					</view>
				</view>
			</view>
		</view>

		<view class="kiss-list" @click="showShield=true">
			<view class="kiss-list-title">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					个人防护
				</view>
				<view class="right1" v-if="isInspec == 0">
					<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
						:class="[drillRecord.shieldName != '' ? 'select-bg' : 'sel']">
						{{ drillRecord.shieldName != '' ? drillRecord.shieldName : '请选择' }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
				<view class="right1" v-else>
					<view :class="[drillRecord.shieldName != '' ? 'select-bg' : '']">
						{{ drillRecord.shieldName != '' ? drillRecord.shieldName : '无' }}
					</view>
				</view>
			</view>
		</view>
		<view class="kiss-list" @click="showOrganize=true">
			<view class="kiss-list-title">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					整体组织
				</view>
				<view class="right1" v-if="isInspec == 0">
					<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
						:class="[drillRecord.organizeName != '' ? 'select-bg' : 'sel']">
						{{ drillRecord.organizeName != '' ? drillRecord.organizeName : '请选择' }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
				<view class="right1" v-else>
					<view :class="[drillRecord.organizeName != '' ? 'select-bg' : '']">
						{{ drillRecord.organizeName != '' ? drillRecord.organizeName : '无' }}
					</view>
				</view>
			</view>
		</view>
		<view class="kiss-list" @click="showDivide=true">
			<view class="kiss-list-title">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					抢险组分工
				</view>
				<view class="right1" v-if="isInspec == 0">
					<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
						:class="[drillRecord.divideName != '' ? 'select-bg' : 'sel']">
						{{ drillRecord.divideName != '' ? drillRecord.divideName : '请选择' }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
				<view class="right1" v-else>
					<view :class="[drillRecord.divideName != '' ? 'select-bg' : '']">
						{{ drillRecord.divideName != '' ? drillRecord.divideName : '无' }}
					</view>
				</view>
			</view>
		</view>
		<view class="kiss-list" @click="showEvaluate=true">
			<view class="kiss-list-title">
				<view class="left">
					<view style="color: red;" v-if="isInspec == 0">*</view>
					实战效果评价
				</view>
				<view class="right1" v-if="isInspec == 0">
					<view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
						:class="[drillRecord.evaluateName != '' ? 'select-bg' : 'sel']">
						{{ drillRecord.evaluateName != '' ? drillRecord.evaluateName : '请选择' }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
				<view class="right1" v-else>
					<view :class="[drillRecord.evaluateName != '' ? 'select-bg' : '']">
						{{ drillRecord.evaluateName != '' ? drillRecord.evaluateName : '无' }}
					</view>
				</view>
			</view>
		</view>

		<view class="line8"></view>
		<view class="kiss-upDown-list">
			<view class="bx-list-title">
				<view class="left">
					<view style="color: red;">*</view>
					存在的问题
				</view>
			</view>
			<view class="input-textrea">
				<u--textarea class="textrea" count v-model="drillRecord.problem" cursorSpacing="60" placeholder="请输入"
					maxlength="500">
				</u--textarea>
			</view>
		</view>
		<view class="kiss-upDown-list">
			<view class="bx-list-title">
				<view class="left">
					<view style="color: red;">*</view>
					改进措施
				</view>
			</view>
			<view class="input-textrea">
				<u--textarea class="textrea" count v-model="drillRecord.measure" cursorSpacing="60" placeholder="请输入"
					maxlength="500">
				</u--textarea>
			</view>
		</view>

		<view class="line8"></view>
		<view class="kiss-title">
			<view class="left">
				<view style="color: red;">*</view>
				演练照片<view v-if="isInspec == 0" style="color: #8c8c8c;">(可传9张)</view>
			</view>
		</view>

		<view class="kiss-upload" style="padding: 0 32rpx 16rpx;">
			<uploadImg :maxCount="isInspec == 0?9:fileList1.length" @getdata="getdata" :fileType="16"
				:fileList="fileList1" :sourceType="sourceType" :deletable="isInspec == 0"
				@deletePicture="deletePicture"></uploadImg>
		</view>
		<view class="bx-title">
			<view class="left">
				演练文件<view style="color: #8c8c8c;">(可传5个)</view>
			</view>
		</view>
		<view class="bx-upload" style="padding: 4rpx 30rpx 32rpx;">
				<view class="tab-list"  v-if="wxfileList.length>0" v-for="(item,index) in wxfileList" :key="index">
					<view class="tab-left">
						<image src="../../../static/images/beijian/wenjian.png"></image>
						<!-- <view class="iconfont icon-app-wenjianxuanzhong iconfontsize"></view> -->
					</view>
					<view class="tab-right">
						<view class="data-txt">
							<view class="txt1">{{item.name}}</view>
							<view class="txt3">{{item.size}}kb</view>
						</view>
						<view class="iconfont icon-app-delete1" style="color: #fa4016;"
							@click="deleteFileitem(item,index)">
						</view>
					</view>
				</view>

			<uploadfile :maxCount="5" :fileType="13" :fileLength="wxfileList.length" @getdata="getdata3">
				<view class="add-file" >
					<view style="font-size: 40rpx;">+</view>添加附件
				</view>
			</uploadfile>
		</view>
		<u-gap height="1" bgColor="#f2f2f2"></u-gap>
		<view class="kiss-upDown-list">
			<view class="bx-list-title">
				<view class="left">
					备注
				</view>
			</view>
			<view class="input-textrea">
				<u--textarea class="textrea" count v-model="drillRecord.remark" cursorSpacing="60" placeholder="请输入备注"
					maxlength="120">
				</u--textarea>
			</view>
		</view>

		<view class="line8"></view>
		<view class="kiss-list" v-if="dataForm.signFlag == 1">
			<view class="kiss-list-title" @click="handleToName">
				<view class="left">
					签到人数
				</view>
				<view class="right1">
					<view class="select-bg" v-if="dataForm.totalNum == dataForm.signNum">
						{{ `全部签到 共${dataForm.totalNum}人` }}
					</view>
					<view class="select-bg" v-else>
						{{ `${dataForm.totalNum - dataForm.signNum}人未签到` }}
					</view>
					<view class="iconfont icon-app-xiangyou sel"></view>
				</view>
			</view>
		</view>
		<view class="kiss-list">
			<view class="kiss-list-title" style="padding: 22rpx 32rpx;">
				<view class="left">
					<view style="color: red;">*</view>
					记录人
				</view>
				<view class="right1">
					<view v-if="drillRecord.recorderSign || sign" class="my-btn2"
						@click="$dianji(handleSeeSign,'onoff2')">
						查看签名
					</view>
					<template v-else>
						<view v-if="isSign" class="my-btn" @click="$dianji(handleCheckSign,'onoff1')">
							一键签名
						</view>
						<template v-else>
							<view @click="$dianji(handleToSetSign,'onoff3')">请签字</view>
							<view class="iconfont icon-app-xiangyou"></view>
						</template>
					</template>
				</view>
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="xing-subside"></view>
		<view class="xing-bottom-double">
			<view class="btn-left" @click="$dianji(draft,'onoff4')">保存为草稿</view>
			<view class="btn-right" @click="$dianji(sumbit,'onoff5')">保存并提交</view>
		</view>

		<u-modal :show="show" title="提示" :showConfirmButton="true" :showCancelButton="true" confirmColor="#0F53AC"
			cancelColor="#576B95" :buttonReverse="true" @confirm="confirm" @cancel="cancel">
			<view class="slot-content my-modal">
				<view>确定提交？提交后参与演练人员将无法进行签到</view>
			</view>
		</u-modal>
		<u-modal :show="showBack" title="提示" :showConfirmButton="true" :showCancelButton="true" confirmColor="#0F53AC"
			cancelColor="#000" :buttonReverse="false" confirmText='保存' cancelText='不保存' @confirm="confirmBack"
			@cancel="cancelBack">
			<view class="slot-content my-modal">
				<view>是否保存当前内容</view>
			</view>
		</u-modal>

		<!-- 预案适宜性评审 -->
		<u-picker :show="showAdequacy" :columns="adequacyColumns" keyName="configValue" @confirm="onChangeAdequacy"
			@cancel="cancelAdequacy">
		</u-picker>
		<!-- 预案充分性评审 -->
		<u-picker :show="showSufficiency" :columns="sufficiencyColumns" keyName="configValue"
			@confirm="onChangeSufficiency" @cancel="cancelSufficiency">
		</u-picker>
		<!-- 人员到位情况 -->
		<u-popup :show="showAdvent" mode="bottom" :round="10">
			<view class="kiss-popup">
				<view class="picker-btn">
					<view class="left" @click="cancelAdvent">取消</view>
					<view style="font-size: 34rpx;font-weight: 500;">人员到位情况(可多选)</view>
					<view class="right" @click="onChangeAdvent">确定</view>
				</view>
				<view class="sex-select">
					<view class="sex-item" :class="[item.checked?'sex-item-active':'']" @click="handleAdventItem(item)"
						v-for="(item,index) in adventColumns[0]" :key="index">
						{{item.configValue}}
						<view class="item-check" v-if="item.checked">
							<u-icon name="checkmark" :color="'#fff'" size="16"></u-icon>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<!-- 现场物资 -->
		<u-picker :show="showMaterials" :columns="materialsColumns" keyName="configValue" @confirm="onChangeMaterials"
			@cancel="cancelMaterials">
		</u-picker>
		<!-- 个人防护 -->
		<u-picker :show="showShield" :columns="shieldColumns" keyName="configValue" @confirm="onChangeShield"
			@cancel="cancelShield">
		</u-picker>
		<!-- 整体组织 -->
		<u-picker :show="showOrganize" :columns="organizeColumns" keyName="configValue" @confirm="onChangeOrganize"
			@cancel="cancelOrganize">
		</u-picker>
		<!-- 抢险组分工 -->
		<u-picker :show="showDivide" :columns="divideColumns" keyName="configValue" @confirm="onChangeDivide"
			@cancel="cancelDivide">
		</u-picker>
		<!-- 实战效果评价 -->
		<u-picker :show="showEvaluate" :columns="evaluateColumns" keyName="configValue" @confirm="onChangeEvaluate"
			@cancel="cancelEvaluate">
		</u-picker>
	</view>
</template>

<script>
	import uploadImg from '../components/uploadimg/uploadimg.vue';
	export default {
		components: {
			uploadImg
		},
		data() {
			return {
				// 培训id
				id: '',
				show: false,
				showBack: false,
				isInspec: 0,
				// 培训详情
				dataForm: {

				},
				// 培训记录
				drillRecord: {
					content: '', //演练过程描述
					problem: '', //存在的问题
					measure: '', //改进措施
					remark: '', //备注
					adequacyName: '', //预案适宜性评审名称
					sufficiencyName: '', //预案充分性评审名称
					adventName: '', //人员到位名称
					materialsName: '', //现场物资名称
					shieldName: '', //个人防护名称
					organizeName: '', //整体组织名称
					divideName: '', //抢险组分工名称
					evaluateName: '', //实战效果评价名称
					drillImgs: '',
					recorderSign: ''
				},
				fileList1: [],
				saveParams: {
					pictures: '',
				},
				sourceType: ['album', 'camera'],
				onoff1: true,
				onoff2: true,
				onoff3: true,
				onoff4: true,
				onoff5: true,
				// 是否设置过签名
				isSign: false,
				oldSign: '',
				// 签名设置
				sign: '',
				showAdequacy: false,
				adequacyColumns: [
					[]
				],
				showSufficiency: false,
				sufficiencyColumns: [
					[]
				],
				showAdvent: false,
				adventColumns: [
					[]
				],
				showMaterials: false,
				materialsColumns: [
					[]
				],
				showShield: false,
				shieldColumns: [
					[]
				],
				showOrganize: false,
				organizeColumns: [
					[]
				],
				showDivide: false,
				divideColumns: [
					[]
				],
				showEvaluate: false,
				evaluateColumns: [
					[]
				],
				configType: [{
						key: 'drill_adequacy',
						value: 'adequacyColumns',
						label: '预案适宜性评审'
					},
					{
						key: 'drill_sufficiency',
						value: 'sufficiencyColumns',
						label: '预案充分性评审'
					},
					{
						key: 'drill_advent',
						value: 'adventColumns',
						label: '人员到位情况'
					},
					{
						key: 'drill_materials',
						value: 'materialsColumns',
						label: '现场物资'
					},
					{
						key: 'drill_shield',
						value: 'shieldColumns',
						label: '个人防护'
					},
					{
						key: 'drill_organize',
						value: 'organizeColumns',
						label: '整体组织'
					},
					{
						key: 'drill_divide',
						value: 'divideColumns',
						label: '抢险组分工'
					},
					{
						key: 'drill_evaluate',
						value: 'evaluateColumns',
						label: '实战效果评价'
					},
				],
				htInfo: {},
				wxfileList: [], //演练文件上传集合
			}
		},
		onLoad(options) {
			this.id = options.id
			this.configType.forEach(item => {
				this.getConfigType(item)
			})
			this.initData()
			this.getSign()
		},
		// onUnload() {
		// 	var pages = getCurrentPages(); //当前页面栈
		// 	if (pages.length > 1) {
		// 		var beforePage = pages[pages.length - 2]; //获取上一个页面实例对象
		// 		beforePage.data.refreshIfNeeded = true;
		// 	}
		// },
		onShow() {
			var pages = getCurrentPages(); // 获取当前页面栈
			var currentPage = pages[pages.length - 1]; // 当前页面
			if (currentPage.data.refreshIfNeeded) {
				currentPage.data.refreshIfNeeded = false;
				this.getSign(true)
			}
		},
		methods: {
			leftClick: async function() {
				const type = await this.judge()

				//这里要判断几个逻辑 1.添加未保存（提示） 2.查看已修改（提示） 3.查看未修改（不提示直接返回）
				if (type) {
					this.showBack = true
				} else {
					//返回上一页面
					uni.navigateBack({
						delta: 1
					})

				}
			},
			getConfigType(item) {
				uni.$u.http.post(`/check/mobile/dataDictionary/dictionaryList`, {
					configType: item.key
				}).then(res => {
					if (res.code == 0) {
						if (item.key == 'drill_advent') {
							res.data.map(item => item.checked = false)
						}
						this[item.value] = [res.data];

					}
				}).catch(err => {})
			},
			getSign(type = false) {
				uni.$u.http.get(`/base/mobile/userInfo/getLoginUserInfo`).then(res => {
					if (res.code == 0) {
						if (res.data.userSign) {
							this.isSign = true
							this.oldSign = res.data.userSign
							if (type) {
								this.sign = res.data.userSign
							}
						}
					}
				}).catch(err => {})
			},
			// 初始数据查询
			initData() {
				uni.$u.http.get(`/check/mobile/drillInfo/getInfo/${this.id}`).then(res => {
					if (res.code == 0) {
						this.dataForm = res.data
						if (res.data.drillRecord && res.data.drillRecord != '') {
							this.drillRecord = res.data.drillRecord
						}
						//异常照片
						this.fileList1 = [];
						if (res.data.drillRecord.drillImgs && res.data.drillRecord.drillImgs != '') {
							this.saveParams.pictures = res.data.drillRecord.drillImgs;
							var pictures = res.data.drillRecord.drillImgs.split(',')
							pictures.forEach(s => {
								let dd = {
									url: s
								}
								this.fileList1.push(dd);
							})
						}
						//附件上传
						if (this.drillRecord.fileNames != "") {
							var fileLists = this.drillRecord.fileNames.split(',')
							var fileSizes = this.drillRecord.fileSizes.split(',')
							var filePathss = this.drillRecord.filePaths.split(',')
							fileLists.forEach((s, index) => {
								let dd = {
									name: s,
									size: fileSizes[index],
									url: filePathss[index]
								}
								this.wxfileList.push(dd);
							})
						}
						// 数据拷贝
						this.htInfo = JSON.parse(JSON.stringify(this.drillRecord))
					}
				}).catch(err => {})
			},
			// 暂存
			draft() {
				const params = {
					...this.drillRecord,
					...{
						drillId: this.id, // 培训id
						drillImgs: this.saveParams.pictures, //照片
						recorderSign: this.drillRecord.recorderSign || this.sign,
					}
				}
				if (params.createTime) delete params.createTime
				if (params.updateTime) delete params.updateTime
				params.draftFlag = 1 // 是否为草稿；0.否  1.是
				this.setData(params)
			},
			// 提交
			sumbit() {
				if (this.drillRecord.content == '') {
					return uni.$u.toast("请填写演练过程、人员培训情况描述")
				}
				if (this.drillRecord.adequacyName == '') {
					return uni.$u.toast("请选择预案适宜性评审")
				}
				if (this.drillRecord.sufficiencyName == '') {
					return uni.$u.toast("请选择预案充分性评审")
				}
				if (this.drillRecord.adventName == '') {
					return uni.$u.toast("请选择人员到位情况")
				}
				if (this.drillRecord.materialsName == '') {
					return uni.$u.toast("请选择现场物资")
				}
				if (this.drillRecord.shieldName == '') {
					return uni.$u.toast("请选择个人防护")
				}
				if (this.drillRecord.organizeName == '') {
					return uni.$u.toast("请选择整体组织")
				}
				if (this.drillRecord.divideName == '') {
					return uni.$u.toast("请选择抢险组分工")
				}
				if (this.drillRecord.evaluateName == '') {
					return uni.$u.toast("请选择实战效果评价")
				}
				if (this.drillRecord.problem == '') {
					return uni.$u.toast("请输入存在的问题")
				}
				if (this.drillRecord.measure == '') {
					return uni.$u.toast("请输入改进措施")
				}
				if (this.saveParams.pictures == '') {
					return uni.$u.toast("请添加演练照片")
				}
				if (this.drillRecord.recorderSign == '' && this.sign == '') {
					return uni.$u.toast("记录员未签名")
				}
				this.show = true
			},
			setData(params) {
				uni.$u.http.post(`/check/mobile/drillInfo/addDrillRecord`, params).then(res => {
					if (res.code == 0) {
						uni.$u.toast('提交成功')
						if (params.draftFlag) {
							setTimeout(() => {
								let pages = getCurrentPages(); //获取所有页面栈实例列表
								let nowPage = pages[pages.length - 1]; //当前页页面实例
								let prevPage = pages[pages.length - 2]; //上一页页面实例
								prevPage.data.recordNeeded = true;
								uni.navigateBack({
									delta: 1
								})
							}, 1000)
						} else {
							setTimeout(() => {
								uni.navigateBack({
									delta: 2
								})
							}, 1000)
						}

					}
				}).catch(err => {})
			},
			//这里写个方法便于判断当前列表信息是否未保存
			judge: function() {
				let obj = this.drillRecord
				let type = false
				//1.先判断是否有过记录
				if (this.dataForm.draftFlag) {
					type = true
				} else if (this.saveParams.pictures != '') {
					type = true
				} else {

					for (let key in obj) {
						if (obj[key]) {
							type = true
						}
					}
				}
				return type
			},
			confirm() {
				this.show = false
				const params = {
					...this.drillRecord,
					...{
						drillId: this.id, // 培训id
						drillImgs: this.saveParams.pictures, //照片
						recorderSign: this.drillRecord.recorderSign || this.sign,
					}
				}
				if (params.createTime) delete params.createTime
				if (params.updateTime) delete params.updateTime

				params.draftFlag = 0 // 是否为草稿；0.否  1.是
				this.setData(params)
			},
			cancel() {
				this.show = false
			},

			confirmBack() {
				this.showBack = false
				// 暂存
				this.draft()
			},

			cancelBack() {
				this.showBack = false
				uni.navigateBack({
					delta: 1
				})
			},

			getdata(e) {
				this.pictrueList = e;
				this.fileList1 = [];
				if (this.pictrueList.length > 0) {
					this.saveParams.pictures = "";
					let arry = []
					this.pictrueList.map(item => {
						arry.push(item.url)
						let dd = {
							url: item.url
						}
						this.fileList1.push(dd);
					})
					this.saveParams.pictures = arry.toString()
				}
			},
			deletePicture(e) {
				this.pictrueList = e;
				this.fileList1 = [];
				this.saveParams.pictures = "";
				if (this.pictrueList.length > 0) {

					let arry = []
					this.pictrueList.map(item => {
						arry.push(item.url)
						let dd = {
							url: item.url
						}
						this.fileList1.push(dd);
					})
					this.saveParams.pictures = arry.toString()
				}
			},
			// 查看全部签名
			handleToName() {
				uni.navigateTo({
					url: `/pages/subPackagesA/emergencyDrill/signList?id=${this.id}`
				})
			},
			handleCheckSign() {
				this.sign = this.oldSign
			},
			handleSeeSign() {
				uni.$u.http.get(
					`/base/upload/bindFileUrl?fileUrl=${this.drillRecord.recorderSign || this.sign}`
				).then(res => {
					if (res.code == 0) {
						uni.navigateTo({
							url: `/pages/subPackagesD/mycenter/sginselect?url=
								${encodeURIComponent(JSON.stringify(res.data))}&noShow=true`
						})
					}
				}).catch(err => {})
			},
			handleToSetSign() {
				uni.navigateTo({
					url: `/pages/subPackagesD/mycenter/signname?nameType=sign`
				})
			},

			//查看进度
			selectJinDu(type) {
				uni.navigateTo({
					url: `/pages/subPackagesC/mineTrain/trainSchedule?type=${type}&trainId=${this.dataForm.id}&isKecheng=${this.dataForm.courseId != ''}&isKaoshi=${this.dataForm.examPaperId != ''}&isQiandao=${this.dataForm.signFlag == 1}`
				})
			},

			onChangeAdequacy(e) {
				if (e.value[0]) {
					this.drillRecord.adequacyName = e.value[0].configValue
					this.drillRecord.adequacyId = e.value[0].id
				}
				this.showAdequacy = false
			},
			cancelAdequacy() {
				this.showAdequacy = false
			},
			onChangeSufficiency(e) {
				if (e.value[0]) {
					this.drillRecord.sufficiencyName = e.value[0].configValue
					this.drillRecord.sufficiencyId = e.value[0].id
				}
				this.showSufficiency = false
			},
			cancelSufficiency() {
				this.showSufficiency = false
			},
			onChangeMaterials(e) {
				if (e.value[0]) {
					this.drillRecord.materialsName = e.value[0].configValue
					this.drillRecord.materialsId = e.value[0].id
				}
				this.showMaterials = false
			},
			cancelMaterials() {
				this.showMaterials = false
			},
			onChangeShield(e) {
				if (e.value[0]) {
					this.drillRecord.shieldName = e.value[0].configValue
					this.drillRecord.shieldId = e.value[0].id
				}
				this.showShield = false
			},
			cancelShield() {
				this.showShield = false
			},
			onChangeOrganize(e) {
				if (e.value[0]) {
					this.drillRecord.organizeName = e.value[0].configValue
					this.drillRecord.organizeId = e.value[0].id
				}
				this.showOrganize = false
			},
			cancelOrganize() {
				this.showOrganize = false
			},
			onChangeDivide(e) {
				if (e.value[0]) {
					this.drillRecord.divideName = e.value[0].configValue
					this.drillRecord.divideId = e.value[0].id
				}
				this.showDivide = false
			},
			cancelDivide() {
				this.showDivide = false
			},
			onChangeEvaluate(e) {
				if (e.value[0]) {
					this.drillRecord.evaluateName = e.value[0].configValue
					this.drillRecord.evaluateId = e.value[0].id
				}
				this.showEvaluate = false
			},
			cancelEvaluate() {
				this.showEvaluate = false
			},
			handleShowAdvent() {
				this.adventColumns[0].map(item => {
					item.checked = false
				})
				if (this.drillRecord.adventId && this.drillRecord.adventId != '') {
					this.adventColumns[0].map(item => {
						this.drillRecord.adventId.split(',').map(it => {
							if (item.id == it) {
								item.checked = true
							}
						})
					})
				}
				this.showAdvent = true
			},
			// 人员到位情况
			handleAdventItem(item) {
				item.checked = !item.checked
			},
			onChangeAdvent() {
				let checkedArr = this.adventColumns[0].filter(item => item.checked)
				let name = []
				let id = []
				checkedArr.forEach(item => {
					name.push(item.configValue)
					id.push(item.id)
				})
				this.drillRecord.adventName = name.join(',')
				this.drillRecord.adventId = id.join(',')
				this.showAdvent = false
			},
			cancelAdvent() {
				this.showAdvent = false
			},
			// 附件上传
			getdata3(e) {
				this.wxfileList.push(e);
				if (this.wxfileList.length > 0) {
					let arry = []
					this.wxfileList.map(item => {
						let str = item.name;
						var indexs = str.indexOf(".")
						var resolves = str.substring(indexs + 1, str.length);
						item.fileType = resolves;
					})
				}
				this.getfileListInfoParams(this.wxfileList)
			},
			getfileListInfoParams(list) {
				if (list.length > 0) {
					this.drillRecord.fileNames = "";
					this.drillRecord.filePaths = "";
					this.drillRecord.fileSizes = "";
					let arry = []
					let arry2 = []
					let arry3 = []
					list.map(item => {
						arry.push(item.name)
						arry2.push(item.url)
						arry3.push(item.size)
					})
					this.drillRecord.fileNames = arry.toString();
					this.drillRecord.filePaths = arry2.toString();
					this.drillRecord.fileSizes = arry3.toString();
				}
			},
			//删除附件
			deleteFileitem(item, index) {
				var that = this;
				uni.showModal({
					title: '提示',
					content: '确定删除该附件吗？',
					success: function(res) {
						if (res.confirm) {
							that.wxfileList.splice(index, 1);
							that.getfileListInfoParams(that.wxfileList)
						} else if (res.cancel) {}
					}
				});

			},
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		.top {
			background-color: #fff;
			padding: 32rpx;

			.title-top {
				font-size: 17px;
				font-weight: 500;
				color: #2B2B2B;
			}

			.top-tags {
				display: flex;
				font-size: 24rpx;
				margin-top: 16rpx;

				.tag-info {
					border-radius: 4px;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					padding: 4px 12px;
					background-color: rgba(140, 140, 140, 0.2);
					color: #8C8C8C;
					margin-right: 24rpx;
				}

				.tag-unStart {
					border-radius: 4px;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					padding: 4px 12px;
					color: rgba(2, 173, 130, 1);
					background: rgba(40, 184, 105, 0.2);
				}
			}
		}

		.my-modal {
			text-align: center;
		}

		.kcInfo {
			padding: 32rpx;
			display: flex;

			.kcInfo-img {
				width: 160rpx;
				height: 160rpx;
				margin-right: 32rpx;
				min-width: 160rpx;
			}

			.kcInfo-con {
				font-weight: 400;
				align-items: flex-end;

				.name {
					font-size: 32rpx;
					color: #2B2B2B;
					margin-bottom: 16rpx;
				}

				.name2 {
					font-size: 28rpx;
					color: #4C4C4C;
				}
			}
		}

		.kcBtn {
			display: flex;
			text-align: center;

			.learn {
				width: 50%;
				border: 2rpx solid #EDEDED;
				padding: 28rpx 0;
				color: black;
			}

			.selectJd {
				width: 100%;
				border: 2rpx solid #EDEDED;
				padding: 28rpx 0;
				color: rgba(15, 83, 172, 1);
			}
		}

		.my-title {
			background-color: #fff;
			padding: 32rpx 32rpx 0 32rpx;
			font-weight: 600;
		}
	}

	.my-btn {
		padding: 12rpx 24rpx;
		background: rgba(255, 255, 255, 1);
		border: 1px solid rgba(15, 83, 172, 1);
		color: rgba(15, 83, 172, 1);
		font-size: 28rpx;
		border-radius: 8rpx;
	}

	.my-btn2 {
		padding: 12rpx 24rpx;
		background: rgba(15, 83, 172, 1);
		border: 1px solid rgba(15, 83, 172, 1);
		color: rgba(255, 255, 255, 1);
		font-size: 28rpx;
		border-radius: 8rpx;
	}

	.sex-select {
		.sex-item {
			word-break: break-all;
			word-wrap: break-word;
			display: flex;
			justify-content: center;
			align-items: center;
			padding: 20rpx;
			border: 1px solid #f2f2f2;
			margin: 32rpx;
			border-radius: 8rpx;
			position: relative;

			.item-check {
				position: absolute;
				right: 0;
				bottom: 0;
				width: 12px;
				height: 12px;
				background-color: #0F53AC;
				color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 10px;
				border-radius: 6px 0 0 0;
			}
		}

		.sex-item-active {
			background-color: rgba(15, 83, 172, 0.1);
			color: #0F53AC;
			border: 1px solid #0F53AC;
		}
	}

	.kiss-list {
		.kiss-list-title {
			.right1 {
				line-height: 24px;
			}
		}
	}

	.sel {
		color: #A6A6A6;
	}

	.tab-list {
		display: flex;
		padding: 24rpx 0 24rpx 20rpx;
		border-radius: 8rpx;
		background: #f2f2f2;
		margin-top: 16rpx;

		.tab-left {
			border-radius: 8rpx;
			display: flex;
			align-items: center;

			image {
				width: 96rpx;
				height: 96rpx;
				border-radius: 8rpx;
			}

			.iconfontsize {
				font-size: 40rpx;
				color: #0F53AC;
			}
		}

		.tab-right {
			width: 100%;
			padding: 0 32rpx 0 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.data-txt {
				.txt1 {
					// width: 550rpx;
					font-size: 28rpx;
					color: #2B2B2B;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					word-wrap: break-word;
					word-break: break-all;
				}

				.txt2 {
					font-size: 28rpx;
					color: #8c8c8c;
					margin-top: 10rpx;
				}

				.txt3 {
					color: #A6A6A6;
					font-size: 28rpx;
					margin-top: 8rpx;
				}
			}
		}

	}
	
	.tab-list:first-child{
		margin-top: 28rpx;
	}
	.add-file {
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 12rpx;
		border: 1px solid #0F53AC;
		margin-top: 30rpx;
		padding: 20rpx 0;
		color: #0F53AC;
		// width: 680rpx;
	}

	.bx-upload {
		padding: 20rpx 30rpx;
		background: #fff;
	}

	.bx-title {
		background: #fff;
		padding: 52rpx 30rpx 0;

		.left {
			display: flex;
			font-size: 32rpx;
			font-weight: 400;
			letter-spacing: 0px;
			line-height: 0px;
			color: #4D4D4D;
			background: #fff;
		}
	}

	/deep/ .u-upload__wrap__preview {
		margin: 0 4vw 4vw 0 !important;
	}

	/deep/ .u-upload__wrap__preview:nth-child(3n) {
		margin-right: 0 !important;
	}
</style>
